package com.stadium.common.enums;

/**
 * @program: smartgame-rugby
 * @description:
 * @author: firstSeven
 * @create: 2020/04/04
 */
public enum  UserTypeEnum {

    平台运营者("1", "ptyyz"),

    组织运营者("2", "zzyyz"),

    球队运营者("3", "qdyyz"),

    球员("4", "qy"),
    裁判("5", "cp"),

    UNKNOWN("0", "未知");
    private String code;
    private String name;

    UserTypeEnum(String code, String name) {
        this.code = code;
        this.name = name;
    }

    public String getCode() {
        return code;
    }

    public void setCode(String code) {
        this.code = code;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public static UserTypeEnum getMethodByCode(String code) {
        for (UserTypeEnum userTypeEnum : UserTypeEnum.values()) {
            if (code.equals(userTypeEnum.getCode())) {
                return userTypeEnum;
            }
        }
        return UserTypeEnum.UNKNOWN;
    }

    public static UserTypeEnum getMethodByName(String name) {
        for (UserTypeEnum userTypeEnum : UserTypeEnum.values()) {
            if (name.equals(userTypeEnum.getName())) {
                return userTypeEnum;
            }
        }
        return UserTypeEnum.UNKNOWN;
    }
}
